<?php

class SiteController extends BaseController {

    public function actionError() {
        $error = Yii::app()->errorHandler->error;
       
	if ($error) {
	    if (!Yii::app()->request->isAjaxRequest) {
		
		 $this->render('/shared/_error', array('error'=>$error));
	    } else {
		if (!param('debugMode')) {
		    $error['message'] = t('MSG_SORRY_INCONVENIENCE', 'messages');
		}

		echo CJSON::encode(array(
		    'status' => MsgType::ERROR,
		    'content' => $error['message'],
		));

		// Stop script execution
		Yii::app()->end();
	    }
	}
    }

}